const {apiPath} = require('../../config');
const {get,post,success,failure} = require('../../common/request');

const moduleApi = {
    /** 创建模块 **/
    create_model: (req,res) => {
        let url = `${apiPath}/cms/create-app-model`;
        let options = {
            data: req.body,
            success: result => success(result,res),
            failure: error => failure(error,res)
        };
        post(url,options);
    },
    /** 根据id获取模块信息 **/
    get_model_by_id: (req,res) => {
        let url = `${apiPath}/cms/get-app-model-by-id`;
        let options = {
            data: req.query,
            success: result => success(result,res),
            failure: error => failure(error,res)
        };
        get(url,options);
    },
    /** 更新模块 **/
    update_model: (req,res) => {
        let url = `${apiPath}/cms/update-app-model`;
        let options = {
            data: req.body,
            success: result => success(result,res),
            failure: error => failure(error,res)
        };
        post(url,options);
    },
    /** 根据模块id获取栏目图片轮播 **/
    get_photos_change_by_id: (req,res) => {
        let url = `${apiPath}/cms/get-photos-change-by-id`;
        let options = {
            data: req.query,
            success: result => success(result,res),
            failure: error => failure(error,res)
        };
        get(url,options);
    },
    /** 创建模块栏目图片轮播 **/
    create_photos_change: (req,res) => {
        let url = `${apiPath}/cms/create-photos-change`;
        let options = {
            data: req.body,
            success: result => success(result,res),
            failure: error => failure(error,res)
        };
        post(url,options);
    },
    /** 更新模块栏目图片轮播 **/
    update_photos_model: (req,res) => {
        let url = `${apiPath}/cms/update-photos-change`;
        console.log(req.body);
        let options = {
            data: req.body,
            success: result => success(result,res),
            failure: error => failure(error,res)
        };
        post(url,options);
    }
};

module.exports = moduleApi;
